home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / game / patch / WHD_StarWars.lha / WHD_StarWars / Install < prev    next >
Text File  |  2001-06-18  |  7KB  |  299 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME "Star Wars")
  5. (set #CFG_APPGUI  "Star Wars")
  6. (set #CFG_APPSLV  "SWHD")
  7. (set #CFG_APPVER  "R0601.1")
  8. (set #CFG_APPCOPY "2001")
  9.  
  10. ;================================================================================
  11.  
  12. ;------------------------------------------------------------------------------------
  13. ; Checks if given program is reachable via the path, if not abort install
  14. ;
  15. ; Entry:    #VP1 = name of program to search for
  16.  
  17. (procedure P_CheckRun (
  18.     (if (<> 0 (run (cat "Which " #VP1)))(
  19.         (abort
  20.             (cat
  21.                 "Could not find the program\n\n"
  22.                 "'" #VP1 "'\n\n"
  23.                 "which is required to perform the installation!\n\n"
  24.                 "Please install the '" #VP1 "' program ensuring that"
  25.                 " it is accessible on the path, then try the installation again."
  26.             )
  27.         )
  28.     ))
  29. ))
  30.  
  31.  
  32. ;------------------------------------------------------------------------------------
  33. ; Create installation directories if required
  34.  
  35. (procedure P_InstallDirs (
  36.     ;
  37.     ; Create data dir if required
  38.     ;
  39.     (if (<> 2 (exists #VDATDIR))(
  40.         (makedir #VDATDIR
  41.             (prompt "The directory '" #VDATDIR "' will now be created")
  42.             (help @makedir-help)
  43.             (confirm)
  44.         )
  45.     ))
  46. ))
  47.  
  48.  
  49. ;------------------------------------------------------------------------------------
  50. ; Determine and set information about version of game being installed
  51. ;
  52.  
  53. (procedure P_SetVersionInfo (
  54.     ; if the file exists, set version information
  55.     (if (<= #VVERINFA 0)(
  56.         (if (= 1 (exists #VDATFILE))(
  57.             ; determine version from CRC
  58.             (working "Determining game version")
  59.  
  60.             (set #VT1 (getsum #VDATFILE))
  61.  
  62.             (set #VVERINFA 0)
  63.             (if (= #VT1 33672024) (set #VVERINFA 1))
  64.         ))
  65.     ))
  66. ))
  67.  
  68.  
  69. ;------------------------------------------------------------------------------------
  70. ; Make game data
  71.  
  72. (procedure P_InstallGame (
  73.     ;
  74.     ; Set path to game data file
  75.     ;
  76.     (set #VDATFILE (tackon #VDATDIR "starwars"))
  77.  
  78.     ;
  79.     ; Install data files if not found or unknown versions
  80.     ;
  81.     (P_SetVersionInfo)
  82.     (if (<= #VVERINFA 0)(
  83.         ;
  84.         ; Tell user what is happening
  85.         ;
  86.         (message
  87.             (cat
  88.                 "\n\n\nThe installer will now create the game data files\n"
  89.                 "Please insert your game disk in drive DF0:\n\n"
  90.                 "Click 'Proceed' when ready."
  91.             )
  92.         )
  93.  
  94.         ;
  95.         ; Call the imager slave
  96.         ;
  97.         (working "Creating data files in '" #VDATDIR "'")
  98.  
  99.         (copyfiles
  100.             (prompt "Copying game files to '" #VDATDIR "'")
  101.             (help @copyfiles-help)
  102.             (source  "DF0:")
  103.             (pattern "~(c|l|s|system-configuration)")
  104.             (dest #VDATDIR)
  105.             (optional fail force)
  106.         )
  107.     ))
  108.  
  109.     ;
  110.     ; Check the main data file was created and
  111.     ; that we know this version of the game
  112.     ;
  113.     (P_SetVersionInfo)
  114.  
  115.     (if (= 0 #VVERINFA)
  116.         (abort
  117.             (cat    "\n*** UNKNOWN VERSION OF GAME! ***\n\n"
  118.                     "The installer does not recognise the version of the\n"
  119.                     "game that you are trying to install.\n\n"
  120.                     "Please contact the author for further information\n"
  121.             )
  122.         )
  123.     )
  124.  
  125.     (if (= -1 #VVERINFA)
  126.         (abort
  127.             (cat    "\n*** DATA FILES NOT CREATED! ***\n\n"
  128.                     "The installer could not extract the game data files.\n\n"
  129.                     "Please contact the author for further information\n"
  130.             )
  131.         )
  132.     )
  133. ))
  134.  
  135. ;------------------------------------------------------------------------------------
  136. ; Install WHDLoad slave program
  137.  
  138. (procedure P_InstallSlave (
  139.  
  140.     (working "Installing slave program")
  141.  
  142.     ; copy slave program
  143.     (set #VT1 "Slave")
  144.     (if (>= #VVERINFA 0) (set #VT1 (cat #VT1 #VVERINFA)) )
  145.     (if (>= #VVERINFB 0) (set #VT1 (cat #VT1 #VVERINFB)) )
  146.     (if (>= #VVERINFC 0) (set #VT1 (cat #VT1 #VVERINFC)) )
  147.  
  148.     (copyfiles
  149.         (prompt "Copying slave program")
  150.         (help @copyfiles-help)
  151.         (source #VT1)
  152.         (newname #CFG_APPSLV)
  153.         (dest #VDESTDIR)
  154.         (nogauge)
  155.         (optional fail force)
  156.     )
  157.  
  158.     (copyfiles
  159.         (prompt "Copying OSEmu module")
  160.         (help @copyfiles-help)
  161.         (source "OSEmu.400")
  162.         (dest #VDATDIR)
  163.         (nogauge)
  164.         (optional fail force)
  165.     )
  166.  
  167.     ; copy GUI program if present
  168.     (if (= 1 (exists "GUI"))(
  169.         (copyfiles
  170.             (prompt "Copying GUI program")
  171.             (help @copyfiles-help)
  172.             (source  "GUI")
  173.             (newname #CFG_APPGUI)
  174.             (dest #VDESTDIR)
  175.             (nogauge)
  176.             (optional fail force)
  177.         )
  178.     ))
  179.  
  180.     ; see if the user wants or needs to install an icon
  181.  
  182.     (set #VT1 (cat #CFG_APPGUI ".info"))
  183.     (if (= 0 (exists (tackon #VDESTDIR #VT1)))(
  184.         ; no icon exists, quietly copy one in
  185.         (set #VT2 1)
  186.     )(
  187.         ; icon exists, ask user if they want to overwrite it
  188.         (set #VT2
  189.             (askbool
  190.                 (prompt (cat "Do you want to replace the \"" #CFG_APPGUI "\" icon (recommended) ?"))
  191.                 (default 1)
  192.                 (help @askchoice-help)
  193.             )
  194.         )
  195.     ))
  196.  
  197.     ; install the icon if required
  198.     (if (= 1 #VT2)(
  199.         ; get choice of icon format
  200.         (set #VT3
  201.             (askchoice
  202.                 (prompt "Which type of icon would you like to install?")
  203.                 (choices "Standard" "NewIcon" "OS3.5+ Coloricon")
  204.                 (help @askchoice-help)
  205.             )
  206.         )
  207.         (if (= 0 #VT3) (set #VT3 ".oi"))
  208.         (if (= 1 #VT3) (set #VT3 ".ni"))
  209.         (if (= 2 #VT3) (set #VT3 ".ci"))
  210.  
  211.         ; install the icon
  212.         (copyfiles
  213.             (prompt "Copying icon")
  214.             (help @copyfiles-help)
  215.             (source (cat "Icon" #VT3))
  216.             (newname #VT1)
  217.             (dest #VDESTDIR)
  218.             (nogauge)
  219.             (optional fail force)
  220.         )
  221.     ))
  222. ))
  223.  
  224. ;------------------------------------------------------------------------------------
  225. (welcome (cat "Welcome to the " #CFG_APPNAME " HD Installer"))
  226.  
  227. ;
  228. ; Initialise
  229. ;
  230. (set @app-name #CFG_APPNAME)
  231. (set #VOLDEXEDIR @execute-dir)
  232. (set #VVERINFA -1)
  233. (set #VVERINFB -1)
  234. (set #VVERINFC -1)
  235. (set #VDESTDIR @default-dest)
  236.  
  237. ;
  238. ; Check settings
  239. ;
  240. (if    (<> @user-level 2)
  241.     (abort "You must select 'Expert' user level")
  242. )
  243.  
  244. (if    (< @installer-version 2818051)
  245.     (abort "This product requires at least version 43.3 of the Installer program")
  246. )
  247.  
  248. ;
  249. ; Check required programs are available
  250. ;
  251. (set #VP1 "WHDLoad")
  252. (P_CheckRun)
  253.  
  254. ;
  255. ; Welcome message
  256. ;
  257. (message "\n\n\nWelcome to the " #CFG_APPNAME " HD Installer " #CFG_APPVER "\n\n"
  258.          "© " #CFG_APPCOPY " Halibut Software\n\n"
  259.          "Please read the documentation thoroughly "
  260.          "before attempting to use this installer!\n\n"
  261.          "Click 'Proceed' to begin..."
  262. )
  263.  
  264. ;
  265. ; Get directory to install in
  266. ;
  267. (set #VDESTDIR
  268.     (askdir
  269.         (prompt "Where would you like the game installed?\n"
  270.                 "If you have an existing installation select that directory,\n"
  271.                 "otherwise create / select the directory to install the game into."
  272.         )
  273.         (help @askdir-help)
  274.         (default @default-dest)
  275.         (disk)
  276.         (newpath)
  277.     )
  278. )
  279. (set #VDESTDIR (expandpath #VDESTDIR))
  280. (set @default-dest #VDESTDIR)
  281. (set #VDATDIR  (tackon #VDESTDIR "data/"))
  282.  
  283. ;
  284. ; Create the installation directories
  285. ;
  286. (P_InstallDirs)
  287.  
  288. ;
  289. ; Install the game data
  290. ;
  291. (P_InstallGame)
  292.  
  293. ;
  294. ; Install the slave
  295. ;
  296. (P_InstallSlave)
  297.  
  298. ;=================================================================
  299. ;$VER: Star Wars Installer script R0601.1 © 2001 Halibut Software